<div class="modal-header">
    <h3>
        Clone project {{config.sourceProject.name}}
        <span class="fa fa-question-circle text-info ot-action" ng-click="help = !help" title="Displays help."></span>
    </h3>
</div>
<form name="thisForm" class="form-horizontal" ng-submit="submit(thisForm.$valid)" novalidate="novalidate">
    <div class="modal-body">
        <div class="col-md-12 alert alert-info" ng-if="help">
            <p>
                A new project will be created and the configuration of the current project will
                be copied into the new one.
            </p>
            <p>
                The selected branch will be also cloned into the new project, with its configuration
                being copied as well.
            </p>
        </div>
        <div class="form-group"
             ng-class="{ 'has-error' : thisForm['name'].$invalid && !thisForm['name'].$pristine }">
            <label class="control-label col-md-3">Name</label>

            <div class="col-md-9">
                <input name="name" class="form-control" ng-model="data.name" required="required"/>
            </div>
        </div>
        <div class="form-group"
             ng-class="{ 'has-error' : thisForm['branch'].$invalid && !thisForm['branch'].$pristine }">
            <label class="control-label col-md-3">Branch</label>

            <div class="col-md-9">
                <select name="branch" class="form-control" ng-model="data.branch" required="required"
                        ng-options="b as b.name for b in branches">
                    <option value="">&nbsp;</option>
                </select>
            </div>
        </div>
        <div class="col-md-12 alert alert-info" ng-if="help">
            <p>
                Note that properties and descriptions of all items can be adjusted during the cloning operation
                by using the <a target="_blank" href="http://regular-expressions.info">regular expressions</a>
                and replacement expressions.
            </p>
        </div>
        <ot-branch-replacements data="data"></ot-branch-replacements>
    </div>
    <div class="modal-footer">

        <div class="ot-alert-{{message.type}} alert-dismissable" ng-show="message">
            <span>{{message.content}}</span>
        </div>

        <button class="btn btn-primary" type="submit" ng-disabled="thisForm.$invalid">OK</button>
        <button class="btn btn-link" type="button" ng-click="cancel()">Cancel</button>
    </div>
</form>